package shell

import "os/exec"

func ExecuteAndGetOutput(command []string) (output []byte, err error) {
	var cmd *exec.Cmd
	if len(command) > 1 {
		cmd = exec.Command(command[0], command[1:]...)
	} else {
		cmd = exec.Command(command[0])
	}

	output, err = cmd.CombinedOutput()

	return
}

func Execute(command []string) (err error) {
	var cmd *exec.Cmd
	if len(command) > 1 {
		cmd = exec.Command(command[0], command[1:]...)
	} else {
		cmd = exec.Command(command[0])
	}

	return cmd.Run()
}
